<div class="row">
	<div class="col-md-12">
		<h1>Danh mục tin tức <small>Quản lý các danh mục tin tức</small></h1>
		<ol class="breadcrumb">
            <li><a href="<?php echo admin_page_url(); ?>"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="<?php echo admin_post_cate_url(); ?>"><i class="fa fa-table"></i> Danh sách các danh mục hiện có</a></li>
        </ol>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <p class="pull-right">
            <a class="btn btn-success" href="<?php echo admin_post_cate_url(INSERT_SLUG);?>"><i class="glyphicon glyphicon-plus-sign"></i> Thêm danh mục</a>
        </p>
    </div>
    <div class="col-md-12">
        <div class="table-responsive">
            <table class="table table-bordered table-hover tablesorter item-list" data-href='<?php echo admin_post_cate_url(UPDATE_SLUG . '/do'); ?>'>
                <thead>
                    <tr>
                        <th class="header"># <i class="fa fa-sort"></i></th>
                        <th class="header">Danh mục <i class="fa fa-sort"></i></th>
                        <th class="header">Thứ tự <i class="fa fa-sort"></i></th>
                        <th class="header">Hoạt động</th>
                        <td>&nbsp;</td>
                    </tr>
                    <tr class="tr-temp hidden warning">
                        <td colspan="6">
                            <form role="form" method="post" data-callback="1">
                                <div class="col-md-7">
                                    <div class="form-group">
                                        <label for="input-post-cate-title">Tên danh mục</label>
                                        <input type="text" class="form-control auto-slug" id="input-post-cate-title" follow-ctr='#input-post-cate-slug' name="post_cate[title]" />
                                    </div>
                                    <div class="form-group">
                                        <label for="input-post-cate-slug">Đường dẫn</label>
                                        <input type="text" class="form-control" id="input-post-cate-slug" name="post_cate[slug]" />
                                    </div>
                                    <div class="form-group">
                                        <label for="input-post-cate-order">Thứ tự</label>
                                        <input type="text" class="form-control" id="input-post-cate-order" name="post_cate[order]" />
                                    </div>
                                </div>
                                <div class="col-md-5">
                                    <div class="checkbox">
                                        <label for="input-post-cate-delete-flg">
                                            <input type="checkbox" id="input-post-cate-delete-flg" name="post_cate[delete_flg]" value="1"/> Hoạt động
                                        </label>
                                    </div>
                                    <p>
                                        <input type="hidden" name="post_cate[case]" value="<?php echo UPDATE_FULL; ?>" />
                                        <input type="hidden" name="post_cate[id]" id="input-post-cate-id" />
                                        <button type="button" class="btn btn-success btn-submit-update">
                                            <i class="glyphicon glyphicon-ok-sign"></i> Cập nhật
                                        </button>
                                        <button type="button" class="btn btn-danger btn-cancel-update">
                                            <i class="glyphicon glyphicon-remove-sign"></i> Huỷ
                                        </button>
                                    </p>
                                </div>
                            </form>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($aPostCate as $index=>$postCate) { ?>
                    <tr class="can-edit" data-id="<?php echo $this->encrypt->encode($postCate->getId()); ?>">
                        <th class="header bg-info"><?php echo $index+1; ?></th>
                        <td>
                            <a class="strong big-title input-post-cate-title" href="<?php echo admin_post_cate_url($postCate->getSlug()); ?>">
                                <?php echo $postCate->getTitle(); ?>
                            </a>
                        </td>
                        <td class="input-post-cate-order strong"><?php echo $postCate->getOrder(); ?></td>
                        <td class="input-post-cate-delete-flg">
                            <input id="chk-delete-<?php echo $index+1; ?>" class="checkbox lb-toggle" data-name="delete_flg" type="checkbox" <?php echo ($postCate->getDeletedAt())!=NULL?'':"checked='checked'"; ?> />
                            <label for="chk-delete-<?php echo $index+1; ?>"></label>
                        </td>
                        <td>
                            <a class="input-post-cate-slug btn btn-success" data-template="<?php echo post_cate_url('{replace_slug}'); ?>"
                                data-slug='<?php echo $postCate->getSlug(); ?>'
                                href="<?php echo post_cate_url($postCate->getSlug()); ?>" target="_blank">
                                <i class='glyphicon glyphicon-share-alt'></i> Xem
                            </a>
                            <a href="<?php echo admin_post_cate_url($postCate->getSlug()); ?>" class="btn btn-primary">
                                <i class="glyphicon glyphicon-pencil"></i> Sửa
                            </a>
                        </td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="clearfix"></div>
</div>